﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Skybot.NewWork.Graph
{
    public partial class ElEntity : UserControl
    {


        PointElement _PointElement = null;
        /// <summary>
        /// 点原素
        /// </summary>
        public PointElement PointElement
        {
            get { return _PointElement; }
            set { _PointElement = value;
            DataContext = value;
            }
        }

        public ElEntity()
        {
            InitializeComponent();
        }
        #region 鼠标操作
        
      
        private void userControl_MouseEnter_1(object sender, MouseEventArgs e)
        {
            Canvas.SetZIndex(this, LayoutManager.Instance.Zindex++);
            ZoomIn.Begin();

        }

        private void userControl_MouseLeave_1(object sender, MouseEventArgs e)
        {
            ZoomOut.Begin();
            if (LayoutManager.Instance.LightCanvas != null)
            {
                LayoutManager.Instance.LightCanvas.Visibility = System.Windows.Visibility.Collapsed;
            }
            LayoutManager.Instance.Page.ClearSelect();
        }

        private void userControl_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
        {
            Canvas.SetZIndex(this, LayoutManager.Instance.Zindex++);
            ZoomIn.Begin();
            if (LayoutManager.Instance.LightCanvas != null)
            {
                LayoutManager.Instance.LightCanvas.Visibility = System.Windows.Visibility.Visible;
            }
            LayoutManager.Instance.Page.OnSelect(this);
        }

        #endregion

        private System.Collections.ObjectModel.ObservableCollection<ElEntity> _From = new System.Collections.ObjectModel.ObservableCollection<ElEntity>();

        /// <summary>
        /// 从别人画到我的线
        /// </summary>
        public System.Collections.ObjectModel.ObservableCollection<ElEntity> From
        {
            get { return _From; }
        }

        private System.Collections.ObjectModel.ObservableCollection<ElEntity> _To = new System.Collections.ObjectModel.ObservableCollection<ElEntity>();
        /// <summary>
        /// 从我画出的线
        /// </summary>
        public System.Collections.ObjectModel.ObservableCollection<ElEntity> To
        {
            get { return _To; }
        }
        /// <summary>
        /// 从别的地方画到我这里的线
        /// </summary>
        public Path FromPath { get; set; }

    }
}
